using System;
using System.Collections.Generic;

namespace OhioState.AssetManaged
{
    /// <summary>
    /// Represents the method that takes a single <typeparamref name="IAssetManaged"/> asset.
    /// </summary>
    /// <param name="asset">A <typeparamref name="IAssetManaged"/> instance.</param>
    public delegate void IAssetManagedHandler(IAssetManaged asset);
    /// <summary>
    /// Represents the method that takes a collection of <typeparamref name="IAssetManaged"/> assets.
    /// </summary>
    /// <param name="assets">A <typeparamref name="IList{T}"/> of 
    /// <typeparamref name="IAssetManaged"/> instances.</param>
    public delegate void IAssetManagedListHandler(IList<IAssetManaged> assets);

    /// <summary>
    /// Basic interface for a publishable asset. It provides a strong name and
    /// methods to be notified if the asset has changed.
    /// </summary>
    public interface IAssetManaged
    {
        /// <summary>
        /// Get or set the <typeparamref name="System.String"/> associated with this asset.
        /// </summary>
        string Name { get; set; }
        /// <summary>
        /// Set the name of the asset.
        /// </summary>
        /// <param name="name">A <typeparamref name="System.String"/>.</param>
        void SetName(String name);
        /// <summary>
        /// Add a listener (or subscriber) to the ChangedEvent. Called everytime a <c>Manipulation</c>
        /// is completed.
        /// </summary>
        /// <param name="e">An <typeparamref name="IAssetManagedHandler"/> delegate.</param>
        /// <remarks>The difference between this method and <typeparamref name="AddChangingEventHandler"/>
        /// allows for a sequence of operations to occur before the manipulation is over and the
        /// ChangedEvent is called. For instance, mouse manipulations may occur continuously, but the 
        /// changed eveent will be fired once the manipulations are over (e.g. on the mouse up event.
        /// The ChangedEvent is typically fired with the EndManipulation of the <typeparamref name="IManipulation"/>
        /// interface.</remarks>
        /// <seealso cref="IManipulator"/>
        /// <seealso cref="RemoveChangedEventHandler"/>
        /// <seealso cref="AddChangingEventHandler"/>
        void AddChangedEventHandler(IAssetManagedHandler e);
        /// <summary>
        /// Remove a listener (or subscriber) to the ChangedEvent.
        /// </summary>
        /// <param name="e">An <typeparamref name="IAssetManagedHandler"/> delegate.</param>
        /// <seealso cref="AddChangedEventHandler"/>
        void RemoveChangedEventHandler(IAssetManagedHandler e);
        /// <summary>
        /// Add an listener (or subscriber) to the ChangingEvent. Called everytime 
        /// any state associated with this type or derived types occurs.
        /// </summary>
        /// <param name="e">An <typeparamref name="IAssetManagedHandler"/> delegate.</param>
        /// <seealso cref="IManipulator"/>
        /// <seealso cref="RemoveChangingEventHandler"/>
        /// <seealso cref="AddChangedEventHandler"/>
        /// <remarks>The listener should also subscribe to the ChangedEvent.</remarks>
        void AddChangingEventHandler(IAssetManagedHandler e);
        /// <summary>
        /// Remove a listener (or subscriber) to the ChangingEvent.
        /// </summary>
        /// <param name="e">An <typeparamref name="IAssetManagedHandler"/> delegate.</param>
        /// <seealso cref="AddChangingEventHandler"/>
        void RemoveChangingEventHandler(IAssetManagedHandler e);
        /// <summary>
        /// Interacts with the <typeparamref name="AssetManager"/> during serialization to reconnect to 
        /// existing assets in the AssetManager rather than duplicating them.
        /// </summary>
        void ReaquireAssets();
    }
}
